package com.tqjc.system.system.asyn;

import com.tqjc.system.common.entity.BO.AddBusinessTaskInfo;
import com.tqjc.system.common.enums.pipeline.BusinessCode;
import com.tqjc.system.core.pipeline.ProcessContext;
import com.tqjc.system.core.pipeline.ProcessMachine;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author 86195
 * @version 1.0
 * @description TODO
 * @date 2023/11/1 9:17
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Slf4j
public class AsynTaskExecuteThread extends Thread{

    private ProcessMachine machine;

    private String taskId;

    private String tankCarNo;


    @Override
    public void run() {
        log.info("异步启动加料任务线程开始,taskId:{}",taskId);
        ProcessContext processContext = new ProcessContext<AddBusinessTaskInfo>();
        AddBusinessTaskInfo processModel = AddBusinessTaskInfo.builder().tankCarNo(tankCarNo).taskId(taskId).build();
        processContext.setProcessModel(processModel);
        processContext.setCode(BusinessCode.ADD_TASK_CODE.getCode());
        machine.process(processContext);
        log.info("异步启动加料任务线程结束,taskId:{}",taskId);

    }
}
